package com.qf.main.content.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.qf.common.db.utils.CommonBeanutils;
import com.qf.main.content.common.qo.DiscoveryClassificationQo;
import com.qf.main.content.entity.DiscoveryClassification;
import com.qf.main.content.mapper.DiscoveryClassificationMapper;
import com.qf.main.content.service.DiscoveryClassificationService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author chengqiang
 * @Create 2024-01-20-13:51
 * @Description:
 */
@Service("DiscoveryClassificationService")
public class DiscoveryClassificationServiceImpl implements DiscoveryClassificationService {

    @Resource
    private DiscoveryClassificationMapper discoveryClassificationMapper;




    @Override
    public Integer saveDiscoveryClassification(DiscoveryClassificationQo discoveryClassificationQo) {
        DiscoveryClassification discoveryClassification = CommonBeanutils.convertTo(discoveryClassificationQo, DiscoveryClassification::new);
        return discoveryClassificationMapper.insert(discoveryClassification);
    }

    @Override
    public Integer removeDiscoveryClassification(Integer id) {

        return discoveryClassificationMapper.deleteById(id);
    }

    @Override
    public List<DiscoveryClassification> queryDiscoveryClassification() {
        return discoveryClassificationMapper.selectList(new QueryWrapper<DiscoveryClassification>());
    }
}
